package com.zhangdi.mgsync.core.utils;

import com.zhangdi.mgsync.core.annotation.SyncFlag;
import org.reflections.Reflections;

import java.util.Set;

/**
 * Created by zhangdi on 2020/07/17 14:26:55.
 */
public class ReflectionUtils {
    public static Set<Class<?>> queryClassBySyncFlag(String packageUrl) {
        Reflections reflections = new Reflections(packageUrl);
        return reflections.getTypesAnnotatedWith(SyncFlag.class);
    }

    public static <T> Set<Class<? extends T>> getSubTypesOf(Class<T> clazz){
        Reflections reflections = new Reflections();
        return reflections.getSubTypesOf(clazz);
    }
}
